package com.yic.module.device.dal.mysql.inspectionPlanEntry;

import java.util.*;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.device.dal.dataobject.inspectionPlanEntry.InspectionPlanEntryDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.device.controller.admin.inspectionPlanEntry.vo.*;

/**
 * 设备检查项 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface InspectionPlanEntryMapper extends BaseMapperX<InspectionPlanEntryDO> {

    default PageResult<InspectionPlanEntryDO> selectPage(InspectionPlanEntryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectionPlanEntryDO>()
                .likeIfPresent(InspectionPlanEntryDO::getName, reqVO.getName())
                .eqIfPresent(InspectionPlanEntryDO::getCode, reqVO.getCode())
                .eqIfPresent(InspectionPlanEntryDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(InspectionPlanEntryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionPlanEntryDO::getId));
    }

    default List<InspectionPlanEntryDO> selectList(InspectionPlanEntryExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InspectionPlanEntryDO>()
                .likeIfPresent(InspectionPlanEntryDO::getName, reqVO.getName())
                .eqIfPresent(InspectionPlanEntryDO::getCode, reqVO.getCode())
                .eqIfPresent(InspectionPlanEntryDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(InspectionPlanEntryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionPlanEntryDO::getId));
    }

    default PageResult<InspectionPlanEntryDO> selectNotSelectPage(InspectionPlanEntryPageReqVO reqVO,List<Long> entryIdList){
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectionPlanEntryDO>()
                .likeIfPresent(InspectionPlanEntryDO::getName, reqVO.getName())
                .eqIfPresent(InspectionPlanEntryDO::getCode, reqVO.getCode())
                .eqIfPresent(InspectionPlanEntryDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(InspectionPlanEntryDO::getCreateTime, reqVO.getCreateTime())
                .notInIfPresent(InspectionPlanEntryDO::getId, entryIdList)
                .orderByDesc(InspectionPlanEntryDO::getId));
    }

}
